#include <iostream>
using namespace std;

struct LNode {
    int data;
    LNode* next;
};

void createList(LNode*& head, int n) {
    head = new LNode;
    head->next = nullptr;
    LNode* tail = head;
    for (int i = 0; i < n; ++i) {
        int num;
        cin >> num;
        LNode* newNode = new LNode;
        newNode->data = num;
        newNode->next = nullptr;
        tail->next = newNode;
        tail = newNode;
    }
}

void inverse(LNode*& L) {
    LNode* p = L->next;
    L->next = nullptr;
    while (p != nullptr) {
        LNode* q = p->next;
        p->next = L->next;
        L->next = p;
        p = q;
    }
}

void printList(LNode* head) {
    LNode* p = head->next;
    while (p != nullptr) {
        cout << p->data;
        if (p->next != nullptr) {
            cout << " ";
        }
        p = p->next;
    }
    cout << endl;
}

void freeList(LNode* head) {
    LNode* p = head;
    while (p != nullptr) {
        LNode* q = p->next;
        delete p;
        p = q;
    }
}

int main() {
    int n;
    while (true) {
        cin >> n;
        if (n == 0) break;
        LNode* head;
        createList(head, n);
        inverse(head);
        printList(head);
        freeList(head);
    }
    return 0;
}